package com.mark.web.bill.entity.vo;

import com.mark.common.utils.DateTimeUtil;
import com.mark.web.bill.entity.dto.GoodsDetail;
import com.mark.web.bill.enums.GoodsEnum;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @Description: 我的加工零件vo实体
 * @Author: Mark
 * @CreateDate: 2019/2/12 12:00
 * @Version: 2.0
 * @Copyright : 豆浆油条个人非正式工作室
 */
@Data
public class GoodsDetailVo {

    /**
     * id
     */
    private Integer id;

    /**
     * 逻辑外键，拥有者id
     */
    private Integer fkOwnerId;

    /**
     * 逻辑外键，加工零件id
     */
    private Integer fkCategoryId;

    /**
     * 加工零件所属的种类名称
     */
    private String categoryName;

    /**
     * 商品名称
     */
    private String goodsName;

    /**
     * 单价,单位-元保留两位小数
     */
    private BigDecimal price;

    /**
     * 排序权重
     */
    private Integer priority;

    /**
     * 状态：1-可用,2-禁用
     */
    private String enableStatus;

    /**
     * 加工零件的图片地址
     */
    private String imgAddr;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 最后一次更新时间
     */
    private String lastEditTime;

    public GoodsDetailVo(GoodsDetail goodsDetail) {
        this.id = goodsDetail.getId();
        this.fkCategoryId = goodsDetail.getFkCategoryId();
        this.fkOwnerId = goodsDetail.getFkOwnerId();
        this.categoryName = goodsDetail.getCategoryName();
        this.goodsName = goodsDetail.getGoodsName();
        this.price = goodsDetail.getPrice();
        this.priority = goodsDetail.getPriority();
        this.enableStatus = GoodsEnum.stateOf(goodsDetail.getEnableStatus());
        this.imgAddr = goodsDetail.getImgAddr();
        this.createTime = DateTimeUtil.dateToStr2(goodsDetail.getCreateTime());
        this.lastEditTime = DateTimeUtil.dateToStr2(goodsDetail.getLastEditTime());
    }

}
